home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / fileutil.zip / MODECHAN.H < prev    next >
C/C++ Source or Header  |  1990-05-19  |  2KB  |  56 lines

  1. /* modechange.h -- definitions for file mode manipulation
  2.    Copyright (C) 1989, 1990 Free Software Foundation, Inc.
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 1, or (at your option)
  7.    any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. /* Masks for the `flags' field in a `struct mode_change'. */
  19.  
  20. /* Affect the execute bits only if at least one execute bit is set already,
  21.    or if the file is a directory. */
  22. #define MODE_X_IF_ANY_X 01
  23.  
  24. /* If set, copy some existing permissions for u, g, or o onto the other two.
  25.    Which of u, g, or o is copied is determined by which bits are set in the
  26.    `value' field. */
  27. #define MODE_COPY_EXISTING 02
  28.  
  29. struct mode_change
  30. {
  31.   char op;            /* One of "=+-". */
  32.   char flags;            /* Special operations. */
  33.   unsigned short affected;    /* Set for u/g/o/s/s/t, if to be affected. */
  34.   unsigned short value;        /* Bits to add/remove. */
  35.   struct mode_change *next;    /* Link to next change in list. */
  36. };
  37.  
  38. /* Masks for mode_compile argument. */
  39. #define MODE_MASK_EQUALS 1
  40. #define MODE_MASK_PLUS 2
  41. #define MODE_MASK_MINUS 4
  42.  
  43. /* Error return values for mode_compile. */
  44. #define MODE_INVALID (struct mode_change *) 0
  45. #define MODE_MEMORY_EXHAUSTED (struct mode_change *) 1
  46.  
  47. #ifdef __STDC__
  48. struct mode_change *mode_compile (char *, unsigned);
  49. unsigned short mode_adjust (unsigned, struct mode_change *);
  50. void mode_free (struct mode_change *);
  51. #else
  52. struct mode_change *mode_compile ();
  53. unsigned short mode_adjust ();
  54. void mode_free ();
  55. #endif
  56.